package com.java8.pangjunjie.optional;

import java.util.Optional;

public class Demo01 {

    public static void show(String msg){
        Optional<String> optional =Optional.ofNullable(msg);
        System.out.println(optional.isPresent());/*判断值是否存在*/
        msg = optional.orElse("xuqiang");

        System.out.println("传递的值："+msg);
        System.out.println(msg.length());
    }

    public static void main(String[] args) {
        String str1=null;
        show("abc");
    }
}
